using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableCopyTaskDao:DaoBase<TableCopyTask>
    {
        public override void AddPrimaryIndex(TableCopyTask model)
        {
            cachePrimary[model.TaskId.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableCopyTask.txt";
        }

        protected override TableCopyTask ParseRowData(string[] rowData)
        {
            TableCopyTask data = new TableCopyTask();
			data.TaskId = rowData [0];
			data.MissionId = rowData [1];

            if (string.IsNullOrEmpty(rowData[2]))
            {
                data.IsBoss = 0;
            }
            else
            {
                data.IsBoss = int.Parse(rowData[2]);
            }
			data.SceneName = rowData [3];
			data.HeroId = rowData [4];

            if (string.IsNullOrEmpty(rowData[5]))
            {
                data.RotateSpeed = 0;
            }
            else
            {
                data.RotateSpeed = double.Parse(rowData[5]);
            }

            if (string.IsNullOrEmpty(rowData[6]))
            {
                data.RestTime = 0;
            }
            else
            {
                data.RestTime = double.Parse(rowData[6]);
            }

            if (string.IsNullOrEmpty(rowData[7]))
            {
                data.BornX = 0;
            }
            else
            {
                data.BornX = double.Parse(rowData[7]);
            }

            if (string.IsNullOrEmpty(rowData[8]))
            {
                data.BornZ = 0;
            }
            else
            {
                data.BornZ = double.Parse(rowData[8]);
            }

            if (string.IsNullOrEmpty(rowData[9]))
            {
                data.BornAngle = 0;
            }
            else
            {
                data.BornAngle = double.Parse(rowData[9]);
            }

            if (string.IsNullOrEmpty(rowData[10]))
            {
                data.WanderR = 0;
            }
            else
            {
                data.WanderR = double.Parse(rowData[10]);
            }

            if (string.IsNullOrEmpty(rowData[11]))
            {
                data.WanderSpeed = 0;
            }
            else
            {
                data.WanderSpeed = double.Parse(rowData[11]);
            }

            if (string.IsNullOrEmpty(rowData[12]))
            {
                data.PursueR = 0;
            }
            else
            {
                data.PursueR = double.Parse(rowData[12]);
            }

            if (string.IsNullOrEmpty(rowData[13]))
            {
                data.PursueSpeed = 0;
            }
            else
            {
                data.PursueSpeed = double.Parse(rowData[13]);
            }

            if (string.IsNullOrEmpty(rowData[14]))
            {
                data.ViewR = 0;
            }
            else
            {
                data.ViewR = double.Parse(rowData[14]);
            }
			data.DeadParticleId = rowData [15];
			data.BornParticleId = rowData [16];

            if (string.IsNullOrEmpty(rowData[17]))
            {
                data.Scale = 0;
            }
            else
            {
                data.Scale = double.Parse(rowData[17]);
            }

            if (string.IsNullOrEmpty(rowData[18]))
            {
                data.BornType = 0;
            }
            else
            {
                data.BornType = int.Parse(rowData[18]);
            }
			data.DropOdds = rowData [19];
			data.SpecialOdds = rowData [20];
			data.FirstDropOdds = rowData [21];

            if (string.IsNullOrEmpty(rowData[22]))
            {
                data.IsDemoFight = 0;
            }
            else
            {
                data.IsDemoFight = int.Parse(rowData[22]);
            }
			data.NextTaskId = rowData [23];

            return data;
        }


        public override void AddOneIndex(TableCopyTask model)
        {
            if (!cacheOneIndex.ContainsKey(model.MissionId.ToString()))
            {
                cacheOneIndex[model.MissionId.ToString()] = new List<TableCopyTask>();
            }
            cacheOneIndex[model.MissionId.ToString()].Add(model);
        }
    

    }

}
